import {HtmlParser} from "../../../version1.1/complier/HtmlParser/HtmlParser";
import {ASTParser} from "../../../version1.1/complier/ASTParser/ASTParser";
import {generate} from "../../../version1.1/complier/CodeGenerator/Codegen";

const TestStrMap = new Map();
const TestResultMap = new Map();

export function putTestStr (name, testStr) {
    TestStrMap.set(name, testStr);
}

export function getTestResult (name) {
    const render = TestResultMap.get(name);
    return render;
}

export function TestRun () {
    const htmlParser = new HtmlParser();
    for (let [name, testStr] of TestStrMap) {
        const hNodeRoot = htmlParser.parse(testStr);
        const astNodeRoot = ASTParser.parse(hNodeRoot, false);
        const render = generate(astNodeRoot, { dataGenFns: [] });
        TestResultMap.set(name, render);
    }
}
